package com.huatai.datadevelop.controller;

import com.huatai.common.api.R;
import com.huatai.datadevelop.entity.DecryptionEntity;
import com.huatai.datadevelop.service.DecryptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

@Slf4j
@Api(value = "脱敏脱密模块",tags = "脱敏脱密模块")
@RestController
@RequestMapping("/decryption")
public class DecryptionController {

    @Autowired
    private DecryptionService decryptionService;

    /**
     * 数据新增或修改
     * @return
     */
	@ApiOperation("数据新增或修改")
    @PostMapping("/decryptionSaveOrUpdate")
    public R decryptionSaveOrUpdate(@RequestBody DecryptionEntity entity){
        return R.data(this.decryptionService.decryptionSaveOrUpdate(entity));
    }

    /**
     * 删除或批量删除
     * @return
     */
	@ApiOperation("删除或批量删除")
    @PostMapping("/deleteByIds")
    public R deleteByIds(@RequestBody List<String> data){
        return R.data(this.decryptionService.removeByIds(data));
    }

    /**
     * 获取列表
     * @param params
     * @return
     */
	@ApiOperation("获取列表")
    @PostMapping("list")
    public R list(@RequestBody Map<String, Object> params){
        return R.data(this.decryptionService.queryPage(params));
    }

    /**
     * 获取数据列表
     * @return
     */
	@ApiOperation("获取数据列表")
    @GetMapping("getDataList")
    public R getDataList(){
        return R.data(this.decryptionService.list());
    }
}
